package com.jdrx.ocp.service;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;

/**
 * @Author: Huangxg
 * @Date: 2019/1/17 17:36
 */
@Service("noticeEventService")
public class NoticeEventService implements ApplicationEventPublisherAware {


    private ApplicationEventPublisher publisher;

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.publisher = applicationEventPublisher;

    }

    public <T extends ApplicationEvent> void publishEvent(T event) {
        //publishing the event here
        publisher.publishEvent(event);
    }
}
